function userInfo() {
  axios.get('/my/userinfo').then(({ data: res }) => {
    // console.log(res);


    form.val('formFilter', res.data)
  })
}
userInfo()

let form = layui.form
let layer = layui.layer
form.verify({
  nickname: function (value, item) {
    if (value.length < 2 || value.length > 6) {
      return "昵称长度时2-6字符"
    }
  }
})



$('#form').on('submit', function (e) {
  e.preventDefault()
  let data = $(this).serialize()
  axios.post('/my/userinfo', data).then(({ data: { status, message } }) => {
    if (status !== 0) {
      return layer.msg(message)
    }

    layer.msg(message)
    window.parent.getUserInfo()
  })
})

$('#btnReset').on('click', function (e) {
  e.preventDefault()
  userInfo()
})
